﻿using System;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;

namespace Treasland.MassiveGridMap.Editor {
    public class GUIStyleUtil {
        public static GUIStyle mapNodeStyle;
        public static GUIStyle selectedMapNodeStyle;
        public static GUIStyle layerNodeStyle;
        public static GUIStyle selectedLayerNodeStyle;
        public static GUIStyle inPointStyle;
        public static GUIStyle outPointStyle;

        public static Texture2D inPointStyleImg;
        public static Texture2D outPointStyleImg;

        private static bool isInited = false;

        public static void InitGUIStyles() {
            if (isInited) {
                return;
            }

            isInited = true;
            mapNodeStyle = new GUIStyle();
            mapNodeStyle.normal.background = EditorGUIUtility.Load("node0.png") as Texture2D;
            mapNodeStyle.border = new RectOffset(12, 12, 12, 12);

            selectedMapNodeStyle = new GUIStyle();
            selectedMapNodeStyle.normal.background = EditorGUIUtility.Load("node0 on.png") as Texture2D;
            selectedMapNodeStyle.border = new RectOffset(12, 12, 12, 12);

            layerNodeStyle = new GUIStyle();
            layerNodeStyle.normal.background = EditorGUIUtility.Load("node4.png") as Texture2D;
            layerNodeStyle.border = new RectOffset(12, 12, 12, 12);

            selectedLayerNodeStyle = new GUIStyle();
            selectedLayerNodeStyle.normal.background = EditorGUIUtility.Load("node4 on.png") as Texture2D;
            selectedLayerNodeStyle.border = new RectOffset(12, 12, 12, 12);

            inPointStyle = new GUIStyle();
            inPointStyleImg = EditorGUIUtility.Load("btn left.png") as Texture2D;
            inPointStyle.normal.background = inPointStyleImg;

            outPointStyle = new GUIStyle();
            outPointStyleImg = EditorGUIUtility.Load("btn right.png") as Texture2D;
            outPointStyle.normal.background = outPointStyleImg;

        }

    }
}

